package com.elinkway.infinitemovies.ui.activity.play;

import android.content.Context;
import android.webkit.JavascriptInterface;

import com.elinkway.infinitemovies.utils.LogUtils;

public class SnifferJavascriptInterface {
    Context mContext;
    SnifferListener mListener;

    public void setmListener(SnifferListener mListener) {
		this.mListener = mListener;
	}

	SnifferJavascriptInterface(Context c) {
        mContext = c;
    }
	
	@JavascriptInterface
    public void logSrc(String src) {
    	if(src==null){
    		LogUtils.e(HTML5VideoSniffer.TAG,"caught nothing");
    	}
    	else{
    		if(mListener != null) {
    			mListener.onSuccess(src);
    		}
    	}
    }
    
    public interface SnifferListener{
    	void onSuccess(String src);
    }
}